<include file="Public:header"/>
<div id="main-content" class="content">
    <ul class="breadcrumb">
        <li><a href="/">首页</a></li>
        <li class="active"><a href="">方法管理</a></li>
        <li class="active">方法列表</li>
    </ul>
    <div class="page-header clearfix">
        <h3>方法管理</h3>
        <ul class="nav nav-tabs">    
            <li>
                <a href="{:U('Function/functionList')}">方法列表</a>
            </li>
            <li class="active">
                <a href="{:U('Function/editFunction')}">编辑方法</a>
            </li>
        </ul>
    </div>

    <div class="content-box-table">
        <form action="{:U('Function/editFunction')}" method="post" class="form-horizontal" role="form">
            <input type="hidden" value="{$function_find['f_id']}" name="f_id" />
            <div class="form-group">
                <label for="f_name" class="col-sm-3 control-label">方法名称：</label>
                <div class="col-sm-9">
                  <input type="text" class="form-control" id="f_name" name="f_name" value="{$function_find.f_name}">
                </div>
            </div>
            <div class="form-group">
                <label for="f_zh_name" class="col-sm-3 control-label">中文名称：</label>
                <div class="col-sm-9">
                  <input type="text" class="form-control" id="f_zh_name" name="f_zh_name" value="{$function_find.f_zh_name}">
                </div>
            </div>
            <div class="form-group">
                <label for="f_desc" class="col-sm-3 control-label">方法描述：</label>
                <div class="col-sm-9">
                  <textarea class="form-control must" id="f_desc" name="f_desc">{$function_find.f_desc}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label for="f_success" class="col-sm-3 control-label">成功返回：</label>
                <div class="col-sm-9">
                  <textarea type="text" class="form-control" id="f_success" name="f_success">{$function_find.f_success}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label for="f_error" class="col-sm-3 control-label">失败返回：</label>
                <div class="col-sm-9">
                  <textarea type="text" class="form-control" id="f_error" name="f_error">{$function_find.f_error}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">返回类型：</label>
                <div class="col-sm-9">
                    <select name="f_type">
                        <option>--请选择--</option>
                        <option value="0" <eq name="function_find['f_type']" value="0">selected</eq>>GET</option>
                        <option value="1" <eq name="function_find['f_type']" value="1">selected</eq>>POST</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所属项目：</label>
                <div class="col-sm-9">
                    <select name="p_id" id="type">
                        <option>--请选择--</option>
                        <volist name="project_list" id="vo">
                            <option value="{$vo['p_id']}">{$vo.p_name}</option>
                        </volist>
                    </select>
                    <select name="mo_id" id="mo">
                        <option>--请选择--</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-9">
                  <button type="submit" class="btn btn-default btn-primary">确认编辑</button>
                </div>
            </div>
        </form>
    </div>


</div>
<script>

    $('#type').change(function () {
        var pid = $(this).val();
        $.ajax({
            url : "{:U('Function/ajaxModule')}",
            type :'POST',
            dataType:"json",
            data:{pid:pid},
            success:function(data){
                if(data){
                    $('#mo').empty();
                    var count = data.length;
                    var i = 0;
                    var option="";
                    option+='<option>--请选择--</option>';
                    for(i=0;i<count;i++){
                        option+="<option value='"+data[i].mo_id+"'>"+data[i].mo_name+"</option>";
                    }
                    $('#mo').html(option);
                } 
            }
        });
    });

</script>
<include file="Public:footer"/>